# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.OSPolicyResourceGroup do
  @moduledoc """
  Resource groups provide a mechanism to group OS policy resources. Resource groups enable OS policy authors to create a single OS policy to be applied to VMs running different operating Systems. When the OS policy is applied to a target VM, the appropriate resource group within the OS policy is selected based on the `OSFilter` specified within the resource group.

  ## Attributes

  *   `inventoryFilters` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyInventoryFilter.t)`, *default:* `nil`) - List of inventory filters for the resource group. The resources in this resource group are applied to the target VM if it satisfies at least one of the following inventory filters. For example, to apply this resource group to VMs running either `RHEL` or `CentOS` operating systems, specify 2 items for the list with following values: inventory_filters[0].os_short_name='rhel' and inventory_filters[1].os_short_name='centos' If the list is empty, this resource group will be applied to the target VM unconditionally.
  *   `resources` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyResource.t)`, *default:* `nil`) - Required. List of resources configured for this resource group. The resources are executed in the exact order specified here.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :inventoryFilters =>
            list(GoogleApi.OSConfig.V1.Model.OSPolicyInventoryFilter.t()) | nil,
          :resources => list(GoogleApi.OSConfig.V1.Model.OSPolicyResource.t()) | nil
        }

  field(:inventoryFilters, as: GoogleApi.OSConfig.V1.Model.OSPolicyInventoryFilter, type: :list)
  field(:resources, as: GoogleApi.OSConfig.V1.Model.OSPolicyResource, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyResourceGroup do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.OSPolicyResourceGroup.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyResourceGroup do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
